//
//  PpBasicEquipmentVC.swift
//  Palmpilot
//
//  Created by 杨伟毅 on 2018/10/22.
//  Copyright © 2018年 杨伟毅. All rights reserved.
//

import UIKit

class PpBasicEquipmentVC: PpBaseViewController,UITableViewDelegate,UITableViewDataSource {
    let baseEquipment = UITableView.init(frame: ZCGRECT(x: 0, y: 0, width: SCREEN_width, height: SCREEN_HEIGHT-TopHeight))
     let titleArr =  [PpLanguageSwitchTool.getString(key: "Wear goods"),PpLanguageSwitchTool.getString(key: "Equipment supplies")]
    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
        self.title = PpLanguageSwitchTool.getString(key: "OCR")
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()
        baseEquipment.delegate = self
        baseEquipment.dataSource = self
        baseEquipment.register(UINib.init(nibName: "PpMainTableViewCell", bundle: Bundle.main), forCellReuseIdentifier: "PpMainTableViewCell")
        baseEquipment.tableFooterView = UIView()
        baseEquipment.separatorStyle = .none
        PpBaseTool.insetTableViewAndUIViewController(baseView: baseEquipment, baseVC: self)
        self.view.addSubview(baseEquipment)
    }
    func numberOfSections(in tableView: UITableView) -> Int {
        return 1
    }
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return titleArr.count
    }
    func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
        return 100
    }
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let basecell:PpMainTableViewCell? = tableView.dequeueReusableCell(withIdentifier: "PpMainTableViewCell") as? PpMainTableViewCell
        basecell?.baseLabel.text = titleArr[indexPath.row]
        basecell?.selectionStyle = .none
        return basecell!
    }
    
    func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        switch(indexPath.row) {
        case 0:
            self.navigationController?.pushViewController(PpWearViewController(), animated: true)
            break
        case 1:
            self.navigationController?.pushViewController(PpEquipmentViewController(), animated: true)
            break
        default:
            break
        }
    }
    

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}
